﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyWordCount
{
    class MainScreen
    {
        public void mainScreen()
        {
            while (true)
            {
                Console.WriteLine("----------------------------------------");
                Console.WriteLine("--------------WordCount 1.0-------------");
                Console.WriteLine("----------------------------------------");
                Console.WriteLine("统计字符数        wc.exe -c file.c  ");
                Console.WriteLine("统计单词总数      wc.exe -w file.c  ");
                Console.WriteLine("统计总行数        wc.exe -l file.c  ");
                Console.WriteLine("统计输出到文件    wc.exe -o outputfile.txt  ");
                Console.WriteLine("----------------------------------------");
                Console.WriteLine("请输入指令：");
                string strcomm = Console.ReadLine();
                ProcessingData wc = new ProcessingData();
                string[] sArray = strcomm.Split(new char[2] { ' ', '-' }, StringSplitOptions.RemoveEmptyEntries);//去空格截取各个字符串信息
                for (int i = 1; i < sArray.Length - 1; i++)
                {
                    switch (sArray[i])
                    {
                        //Convert .ToInt32 (
                        case "c":
                            Console.WriteLine(sArray[sArray.Length - 1] + "  字符数：" + wc.cProsess(sArray[sArray.Length - 1]));
                            break;
                        case "w":
                            Console.WriteLine(sArray[sArray.Length - 1] + "  单词数：" + wc.wProsess(sArray[sArray.Length - 1]));
                            break;
                        case "l":
                            Console.WriteLine(sArray[sArray.Length - 1] + "  行数：" + wc.lProsess(sArray[sArray.Length - 1]));
                            break;
                        case "o":
                            Console.WriteLine(wc.oProcess(sArray[sArray.Length - 1]));
                            break;
                        default:
                            Console.WriteLine("输入的指令 -" + sArray[i] + " 有误！");
                            break;
                    }
                }
                Console.ReadKey();
            }

        }
    }
}
